<template>
  <div>
    <div id="container"></div>
  </div>
</template>
<script>
import { Graph } from '@antv/x6'
import dataJSON from './data1'
export default {
  name: 'index2Page',
  data() {
    return {
      graph: null
    }
  },
  mounted() {
    this.initGraph()
  },
  methods: {
    initGraph() {
      this.graph = new Graph({
        container: document.getElementById('container'),
        width: 800,
        height: 600,
        background: {
          color: '#F2F7FA'
        }
      })
      console.log(dataJSON)
      this.graph.fromJSON(dataJSON) // 渲染元素　　　 this.graph.centerContent() // 居中显示
    }
  }
}
</script>